﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>新增用户</title>
<%@ include file="/page/include.jsp"%>
<!-- Font Awesome -->
<link href="${rootPath }/statics/css/font-awesome.min.css"
	rel="stylesheet">

<!-- Custom Theme Style -->
<link href="${rootPath }/statics/css/custom.css" rel="stylesheet">
<!-- ztree -->
<link
	href="${rootPath }/statics/plugins/zTree/css/zTreeStyle/zTreeStyle.css"
	rel="stylesheet">
</head>
<body class="nav-md" style="background-color: #f7f7f7">
	<div class="container body">
		<div class="main_container">
			<div class="framebody" style="min-height: 100%;" role="main">
				<div class="">
					<div class="page-title">
						<div class="title_left">
							<h3>${opFlag == "edit" ? "编辑用户" : "添加用户" }</h3>
						</div>

					</div>
					<div class="clearfix"></div>
					<div class="row">
						<div class="col-md-12 col-sm-12 col-xs-12">
							<div class="x_panel">
								<div class="x_content">
									<form class="form-horizontal form-label-left" novalidate
										id="userForm"
										action="${rootPath}/user/${opFlag == 'edit' ? 'updateUser' : 'addUser' }"
										method="post">
										<input type="hidden" name="creater" value="admin" /> <input
											type="hidden" id="status" name="status"
											value="${user.status}" /> <input type="hidden" id="dealerId"
											name="dealerId" value="${currDealerId}">
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">用户名称: <span class="required"><font
													color="red">*</font></span>
											</label>
											<div class="col-md-3 col-sm-3 col-xs-12">
												<input id="userName" name="userName"
													value="${user.userName }"
													class="form-control col-md-3 col-xs-12" type="text">
												<input type="hidden" id="id" name="id" value="${user.id }" />
												<input type="hidden" id="opFlag" name="opFlag"
													value="${opFlag}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12">性别:<span
												class="required"><font color="red">*</font></span>
											</label>
											<div class="col-md-3 col-sm-3 col-xs-12">
												<select class="selectpicker form-control col-md-12"
													id="userGender" name="userGender">
													<option value="">全部</option>
												</select> <input type="hidden" id="genderSelected"
													name="genderSelected" value="${user.userGender }" />
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">电话: <span class="required"><font
													color="red">*</font></span>
											</label>
											<div class="col-md-3 col-sm-3 col-xs-12">
												<input id="mobile" name="mobile" value="${user.mobile }"
													class="form-control col-md-3 col-xs-12" type="text">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">工号: <span class="required"><font
													color="red">*</font></span>
											</label>
											<div class="col-md-3 col-sm-3 col-xs-12">
												<input id="userCode" name="userCode"
													value="${user.userCode }"
													class="form-control col-md-3 col-xs-12" type="text"
													${opFlag == 'edit' ? 'disabled' : '' }>
											</div>
										</div>
										<c:if test="${opFlag == 'add' }">
											<div class="item form-group">
												<label class="control-label col-md-3 col-sm-3 col-xs-12"
													for="name">密码: <span class="required"><font
														color="red">*</font></span>
												</label>
												<div class="col-md-3 col-sm-3 col-xs-12">
													<input id="password" name="password"
														value="${user.password }"
														class="form-control col-md-3 col-xs-12" type="password">
												</div>
											</div>
											<div class="item form-group">
												<label class="control-label col-md-3 col-sm-3 col-xs-12"
													for="name">确认密码: <span class="required"><font
														color="red">*</font></span>
												</label>
												<div class="col-md-3 col-sm-3 col-xs-12">
													<input id="confirm_password" name="confirm_password"
														value="${user.confirm_password }"
														class="form-control col-md-3 col-xs-12" type="password">
												</div>
											</div>
										</c:if>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">邮箱: </label>
											<div class="col-md-3 col-sm-3 col-xs-12">
												<input id="email" name="email" value="${user.email }"
													class="form-control col-md-3 col-xs-12" type="text">
												<input type="hidden" name="status" value="1" /> <input
													type="hidden" name="isDelete" value="0" />
											</div>
										</div>
										
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">用户类型: <span class="required"><font
													color="red">*</font></span>
											</label>
											<div class="col-md-3 col-sm-3 col-xs-12">
												<select class="selectpicker form-control col-md-12"
													id="userType" name="userType">
													<option value="">全部</option>
												</select> <input type="hidden" id="user_type_selected"
													name="user_type_selected" value="${user.userType}" />
											</div>
										</div>
										
										<%--
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">岗位: <span class="required"><font
													color="red">*</font></span>
											</label>
											<div class="col-md-3 col-sm-3 col-xs-12">
												<select class="selectpicker form-control col-md-12"
													data-live-search="true" id="positionId" name="positionId">
													<option value="">全部</option>
												</select> <input type="hidden" id="position_id_selected"
													name="position_id_selected" value="${user.positionId}" />
											</div>
										</div>
										
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">大区: <span class="required"><font
													color="red">*</font></span>
											</label>
											<div class="col-md-3 col-sm-3 col-xs-12">
												<select class="selectpicker form-control col-md-12"
													id="bigAreaCode" name="bigAreaCode"
													onchange="getBranch(this.value)">
													<option value="">全部</option>
												</select> <input type="hidden" id="bigAreaCode_selected"
													name="bigAreaCode_selected" value="${user.bigAreaCode}" />
												<input type="hidden" id="bigAreaName" name="bigAreaName"
													value="" />
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">分公司: <span class="required"><font
													color="red">*</font></span>
											</label>
											<div class="col-md-3 col-sm-3 col-xs-12">
												<select class="selectpicker form-control col-md-12"
													id="branchCode" name="branchCode">
													<option value="">全部</option>
												</select> <input type="hidden" id="branchCode_selected"
													name="branchCode_selected" value="${user.branchCode}" /> <input
													type="hidden" id="branchName" name="branchName" value="" />
											</div>
										</div>
										--%>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">组织: <span class="required"><font
													color="red">*</font></span>
											</label>
											<div class="col-md-3 col-sm-3 col-xs-12">
												<input id="combTree" name="orgId" type="text" /> <input
													type="hidden" id="orgId_selected" name="orgId_selected"
													value="${user.orgId}" />
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">头像: <span class="required"></span>

											</label>
											<div class="col-md-3 col-sm-3 col-xs-12">
												<div class="uploadpic_part">
													<ul id="image_container">
														<li>
															<div class="pic1">
																<img src="${rootPath }/statics/images/upload_pic1.png" />
																<input id="upload_user_image" type="file"
																	name="imagePath" onchange="ajaxFileUpload(this)" />
															</div>
														</li>
														<c:if test="${user.path != null}">
															<li>
																<div class="pic1">
																	<img src="<%=PublicConfig.IMG_ROOT_URL%>${user.path }" />
																	<a id="btn_close" href="javascript:void(0)"
																		class="icon_close"></a> 
																	<input type="hidden" name="path" value="${user.path}" />
																</div>
															</li>
														</c:if>
													</ul>
												</div>
												<span class="pictips">建议尺寸：800*800PX，单张大小不超过1M</span>
											</div>
										</div>
										<div class="ln_solid"></div>
										<div class="form-btn-content">
											<a id="btn_save"
												class="btn btn-primary">确定</a>
											<a id="btn_back" class="btn btn-default">返回</a> 
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript"
	src="${rootPath }/statics/plugins/upload/ajaxfileupload.js"></script>
<script type="text/javascript"
	src="${rootPath }/statics/plugins/zTree/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript"
	src="${rootPath }/statics/js/jquery-ztree-combobox-1.0.0.js"></script>
<script type="text/javascript"
	src="${rootPath}/js/auth/user/user_form.js"></script>

<script>
		//最简便调用方式
		//$('#combTree').comboboxTree();
		//自定义参数
		$('#combTree').comboboxTree({
			url: rootPath+'/org/orgTree',
			//param: [], //请求参数
			idKey: 'id', //下拉框树节点id，默认值为id
	        pIdKey: 'pid', //下拉框树节点父id，默认值为pid
	        rootPId: "0", //根节点值,默认值为0
	        nameKey: 'name', //文本key
	        defaultValue: $("#orgId_selected").val() //初始默认值
		});
		
	</script>
</html>